<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>Introduction - Zend Framework Manual</title>

    <link href="../css/shCore.css" rel="stylesheet" type="text/css" />
    <link href="../css/shThemeDefault.css" rel="stylesheet" type="text/css" />
    <link href="../css/styles.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Zend Framework</h1>
<h2>Programmer's Reference Guide</h2>
<ul>
    <li><a href="../en/zend.feed.introduction.html">Inglês (English)</a></li>
    <li><a href="../pt-br/zend.feed.introduction.html">Português Brasileiro (Brazilian Portuguese)</a></li>
</ul>
<table width="100%">
    <tr valign="top">
        <td width="85%">
            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.feed.html">Zend_Feed</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.feed.html">Zend_Feed</a></span><br />
                        <span class="home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.feed.importing.html">Importing Feeds</a></div>
                    </td>
                </tr>
            </table>
<hr />
<div id="zend.feed.introduction" class="section"><div class="info"><h1 class="title">Introduction</h1></div>
    

    <p class="para">
        <span class="classname">Zend_Feed</span> provides functionality for consuming <acronym class="acronym">RSS</acronym>
        and Atom feeds. It provides a natural syntax for accessing elements of feeds, feed
        attributes, and entry attributes. <span class="classname">Zend_Feed</span> also has extensive
        support for modifying feed and entry structure with the same natural syntax, and turning the
        result back into <acronym class="acronym">XML</acronym>. In the future, this modification support could
        provide support for the Atom Publishing Protocol.
    </p>

    <p class="para">
        Programmatically, <span class="classname">Zend_Feed</span> consists of a base
        <span class="classname">Zend_Feed</span> class, abstract <span class="classname">Zend_Feed_Abstract</span>
        and <span class="classname">Zend_Feed_Entry_Abstract</span> base classes for representing Feeds and
        Entries, specific implementations of feeds and entries for <acronym class="acronym">RSS</acronym> and Atom,
        and a behind-the-scenes helper for making the natural syntax magic work.
    </p>

    <p class="para">
        In the example below, we demonstrate a simple use case of retrieving an
        <acronym class="acronym">RSS</acronym> feed and saving relevant portions of the feed data to a simple
        <acronym class="acronym">PHP</acronym> array, which could then be used for printing the data, storing to a
        database, etc.
    </p>

    <blockquote class="note"><p><b class="note">Note</b>: <span class="info"><b>Be aware</b><br /></span>
        

        <p class="para">
            Many <acronym class="acronym">RSS</acronym> feeds have different channel and item properties available.
            The <acronym class="acronym">RSS</acronym> specification provides for many optional properties, so be
            aware of this when writing code to work with <acronym class="acronym">RSS</acronym> data.
        </p>
    </p></blockquote>

    <div class="example" id="zend.feed.introduction.example.rss"><div class="info"><p><b>Example #1 Putting Zend_Feed to Work on RSS Feed Data</b></p></div>
        

        <pre class="programlisting brush: php">
// Fetch the latest Slashdot headlines
try {
    $slashdotRss =
        Zend_Feed::import(&#039;http://rss.slashdot.org/Slashdot/slashdot&#039;);
} catch (Zend_Feed_Exception $e) {
    // feed import failed
    echo &quot;Exception caught importing feed: {$e-&gt;getMessage()}\n&quot;;
    exit;
}

// Initialize the channel data array
$channel = array(
    &#039;title&#039;       =&gt; $slashdotRss-&gt;title(),
    &#039;link&#039;        =&gt; $slashdotRss-&gt;link(),
    &#039;description&#039; =&gt; $slashdotRss-&gt;description(),
    &#039;items&#039;       =&gt; array()
    );

// Loop over each channel item and store relevant data
foreach ($slashdotRss as $item) {
    $channel[&#039;items&#039;][] = array(
        &#039;title&#039;       =&gt; $item-&gt;title(),
        &#039;link&#039;        =&gt; $item-&gt;link(),
        &#039;description&#039; =&gt; $item-&gt;description()
        );
}
</pre>

    </div>
</div>
        <hr />

            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.feed.html">Zend_Feed</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.feed.html">Zend_Feed</a></span><br />
                        <span class="home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.feed.importing.html">Importing Feeds</a></div>
                    </td>
                </tr>
            </table>
</td>
        <td style="font-size: smaller;" width="15%"> <style type="text/css">
#leftbar {
	float: left;
	width: 186px;
	padding: 5px;
	font-size: smaller;
}
ul.toc {
	margin: 0px 5px 5px 5px;
	padding: 0px;
}
ul.toc li {
	font-size: 85%;
	margin: 1px 0 1px 1px;
	padding: 1px 0 1px 11px;
	list-style-type: none;
	background-repeat: no-repeat;
	background-position: center left;
}
ul.toc li.header {
	font-size: 115%;
	padding: 5px 0px 5px 11px;
	border-bottom: 1px solid #cccccc;
	margin-bottom: 5px;
}
ul.toc li.active {
	font-weight: bold;
}
ul.toc li a {
	text-decoration: none;
}
ul.toc li a:hover {
	text-decoration: underline;
}
</style>
 <ul class="toc">
  <li class="header home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></li>
  <li class="header up"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></li>
  <li class="header up"><a href="reference.html">Refer&ecirc;ncia do Zend Framework</a></li>
  <li class="header up"><a href="zend.feed.html">Zend_Feed</a></li>
  <li class="active"><a href="zend.feed.introduction.html">Introduction</a></li>
  <li><a href="zend.feed.importing.html">Importing Feeds</a></li>
  <li><a href="zend.feed.findFeeds.html">Retrieving Feeds from Web Pages</a></li>
  <li><a href="zend.feed.consuming-rss.html">Consuming an RSS Feed</a></li>
  <li><a href="zend.feed.consuming-atom.html">Consuming an Atom Feed</a></li>
  <li><a href="zend.feed.consuming-atom-single-entry.html">Consuming a Single Atom Entry</a></li>
  <li><a href="zend.feed.modifying-feed.html">Modifying Feed and Entry structures</a></li>
  <li><a href="zend.feed.custom-feed.html">Custom Feed and Entry Classes</a></li>
  <li><a href="zend.feed.reader.html">Zend_Feed_Reader</a></li>
  <li><a href="zend.feed.writer.html">Zend_Feed_Writer</a></li>
  <li><a href="zend.feed.pubsubhubbub.introduction.html">Zend_Feed_Pubsubhubbub</a></li>
 </ul>
 </td>
    </tr>
</table>

<script type="text/javascript" src="../js/shCore.js"></script>
<script type="text/javascript" src="../js/shAutoloader.js"></script>
<script type="text/javascript" src="../js/main.js"></script>

</body>
</html>